import Vue from 'vue'
import Vuex from 'vuex'
import post from '@/store/modules/post'
import department from '@/store/modules/department.js'
import getters from './getters'
import taskStore from '@/store/modules/taskStore'
import createPersistedState from 'vuex-persistedstate';


Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    department,
    post,
    taskStore
  },
  getters,
  plugins: [
    createPersistedState({
      key: 'taskStore',
      storage: {
        getItem: (key) => uni.getStorageSync(key),
        setItem: (key, value) => uni.setStorageSync(key, value),
        removeItem: (key) => uni.removeStorageSync(key)
      },
      // 指定要持久化的模块
      paths: ['taskStore']
    })
  ]
})

export default store
